<?php

declare(strict_types=1);

namespace App\Api\Request;

use Mine\MineFormRequest;

class OrderRequest extends MineFormRequest
{
    public function confirmRules(): array
    {
        return [
            'car_id' => 'required|integer|gt:0',
            'city' => 'required|string|max:10',
            'address' => 'required|string|max:50',
            'start_at' => 'required|integer|gt:' . time(),
            'end_at' => 'required|integer|gt:start_at',
        ];
    }

    public function storeRules(): array
    {
        $rules = $this->confirmRules();
        $rules['channel_id'] = 'required|integer|gte:0';
        $rules['lessee_id'] = 'required|integer|gt:0';
//        $rules['insurance_id'] = 'required|integer|gt:0';
        $rules['total_price'] = 'required|integer|gt:0';
        return $rules;
    }

    public function attributes(): array
    {
        return [
            'car_id' => '车辆',
            'city' => '城市',
            'address' => '地址',
            'start_at' => '开始时间',
            'end_at' => '结束时间',
            'channel_id' => '渠道',
            'lessee_id' => '承租人',
            'insurance_id' => '保险',
            'total_price' => '总价',
        ];
    }
}
